<extend name="Public/base"/>

<block name="body">

    <script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
    <div class="main-title cf">
        <h2> 编辑 [{:get_nickname($info['uid'])}]资料</h2>
    </div>
    <!-- 标签页导航 -->
    <div class="tab-wrap">

        <div class="tab-content">
            <!-- 表单 -->
            <form id="form" action="{:U('submitInfo')}" method="post" class="form-horizontal">
                <!-- 基础文档模型 -->
                <label class="item-label">当前管理员账户安全确认：</label>
                <input type="password" name="password" value="" placeholder="请验证管理员密码"/>
                <hr/>
                <foreach name="info" key="k" item="item">

                    <div class="form-item cf">
                        <label class="item-label"><if condition="$k eq 'uid'">会员ID：{$item}<else />{$k|get_member_key}：</if></label>
                        <div class="controls">
                            <if condition="$k eq 'uid'">
                                <!-- 此处不输出UID -->
                                <elseif condition="$k eq 'username'" />
                                <span>{$item}</span>
                                <elseif condition="$k eq 'email'" />
                                <span>{$item}</span><span>修改注册邮箱</span>
                                <elseif condition="$k eq 'email'" />
                                <span>{$item}</span><span>修改注册邮箱</span>
                                <elseif condition="$k eq 'mobile'" />
                                <span>{$item}</span><span><eq name="item" value="">绑定手机<else />修改绑定手机</eq></span>
                                <elseif condition="$k eq 'birthday'" />
                                <input type="text" name="{$k}" class="text input-large time" value="{$item|time_format}" placeholder="请选择时间" />
                                <elseif condition="$k eq 'introduce'" />
                                <label class="textarea">
                                    <textarea name="introduce">{$item}</textarea>
                                    {:hook('adminArticleEdit', array('name'=>$k,'value'=>$item))}
                                </label>

                                <elseif condition="$k eq 'sex'" />
                                <select name="sex">
                                    <option value="0" <eq name="$item" value="0">selected="selected"</eq>>保密</option>
                                    <option value="1" <eq name="$item" value="1">selected="selected"</eq>>男</option>
                                    <option value="2" <eq name="$item" value="2">selected="selected"</eq>>女</option>
                                </select>

                                <elseif condition="$k eq 'status'" />
                                <select name="status">
                                    <option value="1" <eq name="$item" value="1">selected="selected"</eq>>启用</option>
                                    <option value="2" <eq name="$item" value="2">selected="selected"</eq>>禁用</option>
                                </select>

                                <elseif condition="$k eq 'img'" />
                                <div class="controls">
                                    <input type="file" id="upload_picture_{$k}">
                                    <input type="hidden" name="{$k}" id="cover_id_{$k}" value="{$item}"/>
                                    <div class="upload-img-box">
                                        <notempty name="item">
                                            <div class="upload-pre-item"><img src="__ROOT__{$item|get_cover='path'}"/></div>
                                        </notempty>
                                    </div>
                                </div>
                                <script type="text/javascript">
                                    //上传图片
                                    /* 初始化上传插件 */
                                    $("#upload_picture_{$k}").uploadify({
                                        "height"          : 30,
                                        "swf"             : "__STATIC__/uploadify/uploadify.swf",
                                        "fileObjName"     : "download",
                                        "buttonText"      : "上传图片",
                                        "uploader"        : "{:U('File/uploadPicture',array('session_id'=>session_id()))}",
                                        "width"           : 120,
                                        'removeTimeout'	  : 1,
                                        'fileTypeExts'	  : '*.jpg; *.png; *.gif;',
                                        "onUploadSuccess" : uploadPicture{$k},
                                    'onFallback' : function() {
                                        alert('未检测到兼容版本的Flash.');
                                    }
                                    });
                                    function uploadPicture{$k}(file, data){
                                        var data = $.parseJSON(data);
                                        var src = '';
                                        if(data.status){
                                            $("#cover_id_{$k}").val(data.id);
                                            src = data.url || '__ROOT__' + data.path
                                            $("#cover_id_{$k}").parent().find('.upload-img-box').html(
                                                    '<div class="upload-pre-item"><img src="' + src + '"/></div>'
                                            );
                                        } else {
                                            updateAlert(data.info);
                                            setTimeout(function(){
                                                $('#top-alert').find('button').click();
                                                $(that).removeClass('disabled').prop('disabled',false);
                                            },1500);
                                        }
                                    }
                                </script>
                                <elseif condition="$k eq 'description'" />
                                <textarea name="description" id="" cols="80" rows="5">{$item}</textarea>
                                <else />
                                <input type="text" class="text input-medium " name="{$k}" value="{$item}">
                            </if>

                        </div>
                    </div>
                </foreach>

                <div class="form-item cf">
                    <button class="btn submit-btn ajax-post hidden" id="submit" type="submit" target-form="form-horizontal">确 定</button>
                    <a class="btn btn-return" href="">返 回</a>
                    <input type="hidden" name="uid" value="{$info.uid|default=''}"/>
                </div>
            </form>
        </div>
    </div>

</block>

<!-- 加载底部JS -->
<block name="script">
    <include file="Public/footjs" />
</block>

